<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/8/11
 * Time: 13:04
 */

namespace App\Winged\Tenants\Redis;


use Illuminate\Support\Facades\Redis;

/**
 * Class Keys
 *
 * @package App\Winged\Tenants\Redis
 */
class Keys
{
    /**
     * @param $tenant
     * @return array
     */
    public static function getKeys($tenant)
    {
        return [
            'admin_display_name',
            'admin_display_short_name',
            'admin_background',
            'barcodes',
            'logo',
            'logo_large',
            'logo_mini',
            'admin_default_url',
            'repository',
            'services',
            'admin_style',
            'admin_title',
            'tenant_uuid',
            'ios_push_appid',
            'ios_push_appkey',
            'ios_push_secret',
            'android_push_appid',
            'android_push_appkey',
            'android_push_secret',
            'department_domain',
        ];
    }

    /**
     * @param $key
     * @return mixed
     */
    public static function get($key)
    {
        return Redis::get($key);
    }

    /**
     * @param $tenant
     * @return array
     */
    public static function getConfig($tenant)
    {
        $config = [];
        foreach(static::getKeys($tenant) as $val){
            $config [$val] = static::get($tenant . '#' . $val);
        }
        return $config;
    }
}
